package com.example.chang.law_doc.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.chang.law_doc.R;
import com.example.chang.law_doc.utils.ImmersiveStatusbar;

import java.io.InputStream;

/**
 * Created by chang on 2018/3/11.
 * 项目描述：
 */

public class TextActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView tv_back;
    ImageView iv_left;
    TextView textView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_txt);
        ImmersiveStatusbar.getInstance().Immersive(getWindow(),getSupportActionBar());
        ActionBar actionBar=getSupportActionBar();
        if (actionBar!=null){
            actionBar.hide();
        }
        initView();

    }

    private void initView() {
        tv_back= (TextView) findViewById(R.id.tv_back_header);
        tv_back.setOnClickListener(this);
        iv_left= (ImageView) findViewById(R.id.iv_left);
        iv_left.setOnClickListener(this);
        textView = (TextView) findViewById(R.id.textView1);
        InputStream inputStream = getResources().openRawResource(R.raw.text1);
        String string = TxtReader.getString(inputStream);
        textView.setText(string);
        textView.setTextSize(15);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.tv_back_header:
            case R.id.iv_left:
                finish();
                break;
        }
    }
}
